import type { BaseResponse } from '@/utils/request';
import { request } from '@/utils/request';
import { RequestEnum } from '@/enums/httpEnum';

export const loginApi = {
  login: '/sys/login',
  logout: '/sys/logout',
};

/**
 * @description 登录
 * @param {LoginParams} data
 * @returns
 */
export const login = (data: API.LoginParams) => {
  return request<BaseResponse<API.LoginResult>>({
    url: loginApi.login,
    method: RequestEnum.POST,
    data,
  });
};

export const logout = () => {
  return request({
    url: loginApi.logout,
    method: RequestEnum.POST,
  });
};
